<template>
  <div>
    <base-list ref="adjustAccountPage"
               :condition="condition"
               :datas.sync="adjustAccountPage"
               :pageSearch="pageSearch">
      <el-form :inline="true"
               :model="condition"
               class="search-form"
               slot="search"
               label-width="80px">
        <el-row>
          <el-col :span="8"
                  class="search-width4">
            <el-form-item label="审核状态">
              <el-select v-model="condition['search_EQ_status']"
                         placeholder="请选择"
                         clearable
                       filterable>
                <el-option v-for="[key, val] in _dictAdjustStatus"
                           :key="key"
                           :label="val"
                           :value="key"></el-option>
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="5"
                  class="search-width4">
            <el-form-item label="货主">
              <auto-search-name placeholder="请选择"
                                @selectId="v=>condition['search_EQ_cargoOwnerId']=v"
                                :name="form.cargoOwnerName"></auto-search-name>
            </el-form-item>
          </el-col>
          <el-col :span="7" class="search-width4">
                <el-form-item label="跟踪号">
                    <el-input placeholder="请输入" v-model="condition['search_LIKE_pasName']" clearable></el-input>
                </el-form-item>
            </el-col>
            <el-col :span="7" class="search-width4">
                <el-form-item label="存单号">
                    <el-input placeholder="请输入" v-model="condition['search_LIKE_pasName']" clearable></el-input>
                </el-form-item>
            </el-col>
          <el-col :span="5"
                  class="search-width8">
            <el-form-item label="调账时间">
              <el-date-picker style="width:140px;" v-model="condition['search_GTE_startTime']"
                              type="date"
                              placeholder="选择日期"
                              value-format="yyyy-MM-dd"> </el-date-picker> 至
              <el-date-picker style="width:140px;" v-model="condition['search_LTE_endTime']"
                              type="date"
                              placeholder="选择日期"
                              value-format="yyyy-MM-dd"> </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="3"
                  style="width: 190px;">
            <el-button type="primary"
                       icon="el-icon-search"
                       @click="loadData"
                       class="ml-80">查 询</el-button>
            <el-button formVisible="true"
                       icon="el-icon-refresh">
              重置
            </el-button>
          </el-col>
        </el-row>
      </el-form>
      <el-table slot="list"
                :data="adjustAccountPage"
                border
                stripe
                max-height="500">
        <el-table-column type="index"
                         label="序号"
                         width="55">
          <template slot-scope="scope">
            {{ scope.$index+1 }}
          </template>
        </el-table-column>
        <el-table-column prop="id"
                         label="账页号"
                         min-width="80"></el-table-column>
        <el-table-column prop="cargoOwnerName"
                         label="货主"
                         min-width="120"></el-table-column>
        <el-table-column prop="warehouseName"
                         label="账页类型"
                         min-width="80"></el-table-column>
        <el-table-column prop="warehouseName"
                         label="禁止上账"
                         min-width="80"></el-table-column>
        <el-table-column prop="cargoName"
                         label="品名"
                         min-width="80"></el-table-column>
        <el-table-column prop="normStr"
                         label="规格"
                         min-width="80"></el-table-column>
        <el-table-column prop="madeBy"
                         label="材质"
                         min-width="80"></el-table-column>
        <el-table-column prop="madeBy"
                         label="生产厂家"
                         min-width="80"></el-table-column>
        <el-table-column prop="warehouseName"
                         label="结存重量"
                         min-width="80"></el-table-column>
        <el-table-column prop="warehouseName"
                         label="结存件数"
                         min-width="80"></el-table-column>
        <el-table-column prop="warehouseName"
                         label="结存数量"
                         min-width="80"></el-table-column>
        <el-table-column prop="warehouseName"
                         label="预上量"
                         min-width="80"></el-table-column>
        <el-table-column align="center"
                         label="操作"
                         width="120">
          <template slot-scope="scope">
            <el-button size="small"
                       type="text"
                       @click="handleDialogFormOpen(true,scope.row)">
              编辑
            </el-button>
            <el-button type="text"
                       class="danger"
                       size="small"
                       @click="handleRemove(scope.row)">删除
            </el-button>
          </template>
        </el-table-column>
      </el-table>
    </base-list>
    <div style="text-align:center">
      <el-button plain
                 type="info"
                 plain
                 @click="handleRouterPush({path: '/goods/storehouse',name: '仓库管理'})">返回</el-button>
    </div>
    <component :is="component"
               ref="component"
               @clear="component=''"></component>
  </div>
</template>

<script>
import {
  // deleteStorehousePlanType,
  // addAccountPage,
  getAdjustAccountPage
} from '@/api/things/accountPageList'
import addGoodsAccountPage from './addGoodsAccountPage'
import autoSearchName from '@/components/autocomplete/autoSearchName' //货主组件
import autoCargo from '@/components/autocomplete/autoCargo'

export default {
  name: 'storehousePlanType',
  components: {
    addGoodsAccountPage,autoCargo,autoSearchName
  },
  data() {
    return {
      dialogForm: false,
      component: '',
      condition: {}, // 查询条件
      adjustAccountPage: [], // table数组
      pageSearch: getAdjustAccountPage, // 分页查询api接口
      id: '',
      // xinjia
      manageType: '1',
      calculate: '1',
      shipperDatas: [
        {
          value: '123',
          label: '本有科技'
        },
        {
          value: '124',
          label: '港九科技'
        }
      ],
      form: {
        shipper: '', //货主
        proName: '',
        spec1: '',
        spec2: '',
        spec3: '',
        material: '',
        pageNum: '',
        prohouse: '',
        pagetime: '',
        pagetype: '',
        currhouse: ''
      },
      multipleSelection: []
    }
  },
  mounted() {
    this.$nextTick(() => {
      this.loadData()
    })
  },
  methods: {
    handleFormOpen(ref) {
      this.component = ref;
      this.$nextTick(() => {
        this.$refs.component.dialogForm = true
      })
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    loadData() {
      this.$refs.adjustAccountPage.loadData()
    },
    // handleDialogFormOpen(bool, item) {
    //   if (bool) {
    //     let form = JSON.parse(JSON.stringify(item))
    //     let temp = [
    //       {
    //         attrCode: form.attrCode,
    //         attrName: form.attrName,
    //         priority: form.priority,
    //         remark: form.remark
    //       }
    //     ]
    //     this.$refs.storehousePlanTypeAddForm.form = {
    //       id: form.id,
    //       stackPlanType: form.stackPlanType,
    //       stackPlanTypeDesc: form.stackPlanTypeDesc,
    //       warehouseId: form.warehouseId,
    //       warehouseName: form.warehouseName,
    //       orgId: form.orgId,
    //       orgName: form.orgName,
    //       factors: form.factors || temp
    //     }
    //     this.$refs.storehousePlanTypeAddForm.isEdit = true
    //     this.$refs.storehousePlanTypeAddForm.dialogForm = true
    //   } else {
    //     this.$refs.storehousePlanTypeAddForm.dialogForm = true
    //   }
    // },
    // handleRemove(item) {
    //   this.$confirm(`是否删除该数据?`, '提示', {
    //     confirmButtonText: '确定',
    //     cancelButtonText: '取消',
    //     type: 'warning'
    //   })
    //     .then(() => {
    //       deleteStorehousePlanType(item.id).then(res => {
    //         this.$message({
    //           type: 'success',
    //           message: `删除成功!`
    //         })
    //         this.loadData()
    //       })
    //     })
    //     .catch(() => {
    //       this.$message({
    //         type: 'info',
    //         message: '已取消'
    //       })
    //     })
    // },
    // handleRouterPush(val) {
    //   this.$store.commit('ADD_CACHED_VIEWS', val)
    //   this.$router.push(val.path)
    // }
  }
}
</script>

<style>
.control-line {
  height: 30px;
}
.line {
  border-left: solid 5px #00a1ff;
  height: 18px;
  margin-top: 5px;
  display: inline-block;
  vertical-align: sub;
}
.gg-input .el-form-item__content .el-input {
  width: 120px !important;
}
.search-width6 .el-date-editor {
  width: 240px;
}
.search-width8 {
  width: 420px;
}
.search-width8 .el-form-item {
  margin-bottom: 18px;
}
</style>
